<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
	<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
	<meta name="language" content="en" />

	<!-- blueprint CSS framework -->
	<link rel="stylesheet" type="text/css" href="<?php echo Yii::app()->request->baseUrl; ?>/css/screen.css" media="screen, projection" />
	<link rel="stylesheet" type="text/css" href="<?php echo Yii::app()->request->baseUrl; ?>/css/print.css" media="print" />
	<!--[if lt IE 8]>
	<link rel="stylesheet" type="text/css" href="<?php echo Yii::app()->request->baseUrl; ?>/css/ie.css" media="screen, projection" />
	<![endif]-->

	<link rel="stylesheet" type="text/css" href="<?php echo Yii::app()->theme->baseUrl; ?>/css/main.css" />
	<link rel="stylesheet" type="text/css" href="<?php echo Yii::app()->theme->baseUrl; ?>/css/form.css" />

    

	<title><?php echo CHtml::encode($this->pageTitle); ?></title>
</head>

<body>

<div class="container" id="page">

	<div id="header">
		<div id="logo"><?php /*?><?php echo CHtml::encode(Yii::app()->name); ?><?php */?></div>
	</div><!-- header -->

	<div id="mainmenu">
    <?php
//              menus
               $Financeiro = false; 
               $UserAdmin  = false;
               $Polo       = false;
               $UserEad    = false;
               $Financeiro = ($Financeiro == false) ? User::model()->findRules('cad_entradas','baixados') :true;
               $Financeiro = ($Financeiro == false) ? User::model()->findRules('cad_entradas','create') :true;
               $Financeiro = ($Financeiro == false) ? User::model()->findRules('cad_entradas','baixa') :true;
               $Financeiro = ($Financeiro == false) ? User::model()->findRules('cad_forma','index') :true;        
               $UserAdmin  = ($UserAdmin == false) ? User::model()->findRules('cad_user','index') :true; 
               $UserAdmin  = ($UserAdmin == false) ? User::model()->findRules('cad_grupos','index') :true;
               $UserAdmin  = ($UserAdmin == false) ? User::model()->findRules('cad_roles','index') :true;
               $UserAdmin  = ($UserAdmin == false) ? User::model()->findRules('cad_roles','index') :true;
               $UserAdmin  = ($UserAdmin == false) ? User::model()->findRules('cad_lookup','index') :true;
               $UserAdmin  = ($UserAdmin == false) ? User::model()->findRules('cad_associacao','index') :true;
               $UserAdmin  = ($UserAdmin == false) ? User::model()->findRules('cad_aluno','report') :true;
               $Polo       = ($Polo == false) ? User::model()->findRules('cad_polo','admin') :true;
               $Polo       = ($Polo == false) ? User::model()->findRules('cad_cursos','admin') :true;
               $Polo       = ($Polo == false) ? User::model()->findRules('cad_periodo','admin') :true;
               $Polo       = ($Polo == false) ? User::model()->findRules('cad_periodo','admin') :true;
               $Polo       = ($Polo == false) ? User::model()->findRules('cad_turma','admin') :true;
               $UserEad    = ($UserEad == false) ? User::model()->findRules('cad_professor','index') :true;        
               $UserEad    = ($UserEad == false) ? User::model()->findRules('cad_professor','create') :true;
               $UserEad    = ($UserEad == false) ? User::model()->findRules('cad_professor','admin') :true;                  
               $UserEad    = ($UserEad == false) ? User::model()->findRules('cad_professor','admin') :true;
               $UserEad    = ($UserEad == false) ? User::model()->findRules('cad_aluno','index') :true;
               $UserEad    = ($UserEad == false) ? User::model()->findRules('cad_aluno','create') :true;
               $UserEad    = ($UserEad == false) ? User::model()->findRules('cad_aluno','admin') :true;
               $UserEad    = ($UserEad == false) ? User::model()->findRules('cad_log','index') :true;
                               
		$this->widget('application.extensions.mbmenu.MbMenu',array(
			'items'=>array(
				   array('label'=>'Login', 'url'=>array('site/login'), 'visible'=>Yii::app()->user->isGuest),
				   array('label'=>'Logout ('.User::model()->loadTableUser(Yii::app()->user->id).')', 'url'=>array('site/logout'), 'visible'=>!Yii::app()->user->isGuest),
				   array('label'=>'Financeiro', 'url'=>array('cad_entradas/baixados'),'visible'=>$Financeiro,
                                     'items'=>array(
                                             array('label'=>'Baixas',    'url'=>array('cad_entradas/baixados'),'visible'=>User::model()->findRules('cad_entradas','baixados'),),                                       
                                             array('label'=>'Novo Débito', 'url'=>array('cad_entradas/create'),'visible'=>User::model()->findRules('cad_entradas','create')),                                                         
                                             array('label'=>'Débitos Abertos', 'url'=>array('cad_entradas/baixa'),'visible'=>User::model()->findRules('cad_entradas','baixa')),   
                                             array('label'=>'Formulários', 'url'=>array('cad_forma/create'),'visible'=>User::model()->findRules('cad_forma','index'),
                                                     'items'=>array(
                                                          array('label'=>'Formas de pagamento',    'url'=>array('cad_forma/create'),),
                                                          array('label'=>'Centros de Custo', 'url'=>array('cad_custo/create'),),
                                                       ),                                                
                                                  ),                                          
                                       ),),
                                   array('label'=>'Usuário Admin', 'url'=>array('index'),'visible'=>$UserAdmin,
                                     'items'=>array(
                                             array('label'=>'Relatórios','visible'=>User::model()->findRules('cad_aluno','report'),
                                                      'items'=>array(                                                    
                                                          array('label'=>'Alunos',   'url'=>array('cad_aluno/report'),),
                                                          array('label'=>'Mensalidade/Curso',   'url'=>array('cad_cursos/report'),),
                                                          array('label'=>'Mensalidade/Pagas/Curso',   'url'=>array('cad_cursos/reportPagas'),),
                                                          array('label'=>'Tipo/Pagamentos',   'url'=>array('cad_cursos/reportTipo'),),
                                                          array('label'=>'Origem/Matrícula',   'url'=>array('cad_aluno/reportHorigem'),),
                                                       ),
                                                 ),
                                             array('label'=>'Usuários',   'url'=>array('user/index'),'visible'=>User::model()->findRules('cad_user','index')),
                                             array('label'=>'Associação', 'url'=>array('cad_associacao/index'),'visible'=>User::model()->findRules('cad_associacao','index'),
                                                     'items'=>array(
                                                          array('label'=>'Novo',        'url'=>array('cad_associacao/create'),),
                                                          array('label'=>'Gerenciar',   'url'=>array('cad_associacao/admin'),),
                                                       ),
                                                  ),
                                             array('label'=>'Gestores', 'url'=>array('cad_gestor/index'),'visible'=>User::model()->findRules('cad_gestor','index'),
                                                     'items'=>array(
                                                          array('label'=>'Novo',      'url'=>array('cad_gestor/create'),),
                                                          array('label'=>'Gerenciar', 'url'=>array('cad_gestor/admin'),),
                                                       ),
                                                  ),                                         
                                             array('label'=>'Parceiros', 'url'=>array('cad_parceiros/index'),'visible'=>User::model()->findRules('cad_parceiros','index'),
                                                     'items'=>array(
                                                          array('label'=>'Novo',      'url'=>array('cad_parceiros/create'),),
                                                          array('label'=>'Gerenciar', 'url'=>array('cad_parceiros/admin'),),
                                                       ),
                                                  ),                                         
                                             array('label'=>'Grupos',     'url'=>array('cad_grupos/index'),'visible'=>User::model()->findRules('cad_grupos','index')),
                                             array('label'=>'Permissões', 'url'=>array('cad_roles/index'),'visible'=>User::model()->findRules('cad_roles','index')),
                                             array('label'=>'Documentos', 'url'=>array('cad_doc/index'),'visible'=>User::model()->findRules('cad_doc','index')),
                                             array('label'=>'Arquivos',   'url'=>array('cad_arq/index'),'visible'=>User::model()->findRules('cad_arq','index')),
                                             array('label'=>'Listas de Itens', 'url'=>array('cad_lookup/index'),'visible'=>User::model()->findRules('cad_lookup','index')),

                                                ),
                                             ),           
                            
                                  array('label'=>'Polo', 'url'=>array('index'),'visible'=>$Polo,
                                    'items'=>array(
                                             array('label'=>'Polos', 'url'=>array('cad_polo/index'),'visible'=>User::model()->findRules('cad_polo','admin'),
                                                     'items'=>array(
                                                          array('label'=>'Novo',      'url'=>array('cad_polo/create'),),
                                                          array('label'=>'Gerenciar', 'url'=>array('cad_polo/admin'),),
                                                       ),
                                                  ),
                                             array('label'=>'Cursos', 'url'=>array('cad_cursos/index'),'visible'=>User::model()->findRules('cad_cursos','admin'),
                                                     'items'=>array(
                                                          array('label'=>'Novo',      'url'=>array('cad_cursos/create'),),
                                                          array('label'=>'Gerenciar', 'url'=>array('cad_cursos/admin'),),
                                                       ),
                                                  ),
                                             array('label'=>'Periodos', 'url'=>array('cad_periodo/index'),'visible'=>User::model()->findRules('cad_periodo','admin'),
                                                     'items'=>array(
                                                          array('label'=>'Novo',      'url'=>array('cad_periodo/create'),),
                                                          array('label'=>'Gerenciar', 'url'=>array('cad_periodo/admin'),),
                                                       ),
                                                  ),
                                             array('label'=>'Turmas', 'url'=>array('cad_turma/index'),'visible'=>User::model()->findRules('cad_turma','admin'),
                                                     'items'=>array(
                                                          array('label'=>'Novo',      'url'=>array('cad_turma/create'),),
                                                          array('label'=>'Gerenciar', 'url'=>array('cad_turma/admin'),),
                                                       ),
                                                  ),
                                                ),
                                         ),  
                                         
                                  array('label'=>'Usuário EAD', 'url'=>array('index'),'visible'=>$UserEad,
                                    'items'=>array( 
                                             array('label'=>'Professores', 'url'=>array('cad_professor/index'),'visible'=>User::model()->findRules('cad_professor','index'),
                                                     'items'=>array(
                                                          array('label'=>'Novo',      'url'=>array('cad_professor/create'),'visible'=>User::model()->findRules('cad_professor','create')),
                                                          array('label'=>'Gerenciar', 'url'=>array('cad_professor/admin'),'visible'=>User::model()->findRules('cad_professor','admin')),
                                                       ),
                                                  ),                                        
                                             array('label'=>'Alunos', 'url'=>array('cad_aluno/index'),'visible'=>User::model()->findRules('cad_aluno','index'),
                                                     'items'=>array(
                                                          array('label'=>'Novo',      'url'=>array('cad_aluno/create'),'visible'=>User::model()->findRules('cad_aluno','create')),
                                                          array('label'=>'Gerenciar', 'url'=>array('cad_aluno/admin'),'visible'=>User::model()->findRules('cad_aluno','admin')),
                                                          array('label'=>'Documentos', 'url'=>array('cad_arq/admin'),'visible'=>User::model()->findRules('cad_arq','admin')),
                                                       ),
                                                  ),
                                             array('label'=>'Logs', 'url'=>array('cad_log/index'),'visible'=>User::model()->findRules('cad_log','index')),
                                      ),
                                   ),
                            ),
                     ));
		?>
	</div><!-- mainmenu -->

	
		<?php echo $content; ?>
	
	
	<?php if(isset($this->breadcrumbs)):?>
	<?php $this->widget('zii.widgets.CBreadcrumbs', array(
			'links'=>$this->breadcrumbs,
			'homeLink'=>''
		)); ?><!-- breadcrumbs -->
	<?php endif?>
	
	<div id="footer" style=" background:url('<?php echo Yii::app()->request->baseUrl; ?>/themes/hachimaki/imagens/rodape3.png') no-repeat scroll top center transparent;">
		Copyright &copy; <?php echo date('Y'); ?> por CaféEAD - Todos os direitos reservados.<br/>
	</div><!-- footer -->

</div><!-- page -->

</body>
</html>
